function HandlePageBackendCeremonys(gui, operator, now, options) {
  this._gui = gui;
  this._operator = operator;
  this._now = now;
  this._options = options;
  
  this._createElements();
};

HandlePageBackendCeremonys.prototype._createElements = function() {
  var _self = this;
  this._gui.add.onclick = function() { if (_self._operator.type == '{{$smarty.const.USER_TYPE_MANAGER_ASSISTANT|escape:javascript}}') {
                                         location.href = '?p=pageasst&t=pagebackendceremony&m=' + JSON.stringify({ a: 5, b: 5 }); 
                                       } else if (_self._operator.type == '{{$smarty.const.USER_TYPE_MANAGER|escape:javascript}}') {
                                         location.href = '?p=pagemanager&t=pagebackendceremony&m=' + JSON.stringify({ a: 5, b: 5 }); 
                                       } else {
                                         location.href = '?p=pageadmin&t=pagebackendceremony&m=' + JSON.stringify({ a: 5, b: 5 }); 
                                       }
                                     };
  this._loadData();
};

HandlePageBackendCeremonys.prototype._loadData = function() {
  var tr, td;
  tr = this._gui.result.insertRow(-1);
  td = tr.insertCell(-1);
  td.appendChild(DOMUtils.getLoadingImage());
  
  this._ceremonys = null;
  this._retrieveCeremonys();
};

HandlePageBackendCeremonys.prototype._verifyData = function() {
  if (this._ceremonys) {
    this._updateElements();
  }
};

HandlePageBackendCeremonys.prototype._retrieveCeremonys = function(page, condition, date, from, to, pos) {
  var _self = this;
  /*new RequestUtils()._read('iceremony', null, null, null, null, 'd.name', null, function(result, params) { _self._ceremonys = result.data;
                                                                                                           _self._verifyData.call(_self);
                                                                                                         }, null);*/
  new RequestUtils()._mysql('iceremony', null, function(result, params) { _self._ceremonys = result.data;
                                                                          _self._parameters = result;
                                                                          _self._verifyData.call(_self);
                                                                        }, {php:'customphp/mysqlread.php',pos: (pos) ? pos : null });                                                                                                         
                                                                                                         
};

HandlePageBackendCeremonys.prototype._updateElements = function() {
  var tr, td, _self = this;
  DOMUtils.removeTableRows(this._gui.result, 1);
  
  if (this._ceremonys.length == 0) {
    tr = this._gui.result.insertRow(-1);
    td = tr.insertCell(-1);
    td.colSpan = 2;
    td.style.height = '24px';
    td.style.textAlign = 'center';
    td.style.borderRight = 'solid 1px #694247';
    td.style.borderLeft = 'solid 1px #694247';
    td.style.borderBottom = 'solid 1px #694247';
    td.style.backgroundColor = '#fff';
    td.appendChild(document.createTextNode('N/A'));
  }
  
  MiscUtils.sort(this._ceremonys, ['name']);
  for(var i = 0, il = this._ceremonys.length; i < il; i++) {
    var c = this._ceremonys[i];
    
    tr = this._gui.result.insertRow(-1);
    new ITableRowCeremony(tr, c, {callbackFunc: function() { _self._createElements(); }, operator: this._operator });
  }
};

